<!DOCTYPE html>
<html>
<head>
    <include file="./public/sty.html"/>
    <style>
        .yz3,.yz4{text-align: left !important; margin-left: 20px;}
        .yz3 :before,.yz4 :before{ font-family: iconfont;
            font-style: inherit;
            padding: 0 5px;
            font-size: 14px;content: "\E60D";}
    </style>
</head>
<body>
<div id="app" class="setSafePwd">
    <include file="./public/header.html"/>

    <div class="container notSign fix pt15" s="[object Object]">
        <div class="userMain mgb10">
            <ul class="queue">
                <li class="now"><span>设置安全密码</span><i></i></li>
                <li><span>完成</span><i></i></li>
            </ul>
            <form action="{:U('Users/setSafePwd')}" method="post" id="form">
                <input type="hidden" name="id" id="uid" value="{$id}">
            <ul class="submitContent mglr30 mgt15">
                <li><span>安全密码：</span> <input type="password" style="display: none;">
                    <input tag="安全密码" regmsg="安全密码应为6-16位字符" type="password" id="pass1" autocomplete="off"  placeholder="请输入安全密码" class="userInput"><span class="yz3" style="width: 300px"></span><!----></li> <!---->
                </li>
                <li><span>确认密码：</span> <input type="password" style="display: none;">
                    <input tag="确认密码" regmsg="确认密码应为6-16位字符" id="pass2" type="password" autocomplete="off" placeholder="请再次输入安全密码" class="userInput _no_paste"><span class="yz4" style="width: 300px"></span>
                    <!----></li>
                <li><span></span> <a class="submitBtn"  onclick="sav()">确定</a></li>
            </ul>
            </form>
        </div>
    </div>

    <include file="./public/footer.html"/>
</div>


<script src="/style/js/jquery.min.js"></script>
<script src="/style/js/fx.js"></script>
<script>
    $(function () {
        personalInfo();
    })
</script>
</body>
</html>
<script>
    function sav(){
        var id = $("#uid").val();
        var pass1 = $("#pass1").val();
        var pass2= $("#pass2").val();
        if(pass1 == ''){
            $(".yz3").html("<font color='red'>密码不能为空</font>");
            return false;
        }else {
            $(".yz3").html("");
        }
        if(pass1.length < 6 || pass1.length > 20 ){
            $(".yz3").html("<font color='red'>密码必须是6~20位</font>");
            return false;
        }else {
            $(".yz3").html("");
        }
        if(pass2 == ''){
            $(".yz4").html("<font color='red'>确认密码不能为空</font>");
            return false;
        }else {
            $(".yz4").html("");
        }
        if(pass1 != pass2){
            $(".yz4").html("<font color='red'>两次输入的密码不一致</font>");
            return false;
        }else {
            $(".yz4").html("");
        }

        $.ajax({
            type: "POST",
            url: "{:U('Users/setSafePwd')}",
            data: {'pass':pass1,'id':id},
            success: function(dat){
                if(dat==1){
                    window.location.href="{:U('Users/securityCenter')}";
                }
            }
        });
    }
</script>